-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for persisting dates with microsecond precision #29
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, that was easy :)
@@ -37,7 +37,8 @@ extension Date: PostgreSQLDataCustomConvertible { | |||
|
|||
/// See `PostgreSQLDataCustomConvertible.convertToPostgreSQLData()` | |||
public func convertToPostgreSQLData() throws -> PostgreSQLData { | |||
return PostgreSQLData(type: .timestamp, format: .text, data: Data(description.utf8)) | |||
return PostgreSQLData(type: .timestamp, format: .binary, | |||
data: Int64(self.timeIntervalSince(_psqlDateStart) * Double(_microsecondsPerSecond)).data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please format with only 1 tab indentation, or all on one line (no "xcode formatting")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Note that I have not made parsing the textual format of the timestamp type more accurate - do we need that? If so, where is that format documented?
Note that I have not made parsing the textual format of the timestamp type more accurate - do we need that? If so, where is that format documented?